﻿using System;
using System.Collections.Generic;
using Microsoft.MediaCenter.Hosting;
using OpenMCPL.MediaCenter.Code.Controls;

namespace OpenMCPL.MediaCenter.Code
{
    public class HistoryOrientedPageSessionEx : HistoryOrientedPageSession
    {
        private VirtualApplication application;//our app instance
        // Methods

        internal HistoryOrientedPageSessionEx(VirtualApplication application)
            : base()
        {
            this.application = application;
        }

        public void GoToPageWithoutHistory(string source, IDictionary<string, object> uiProperties)
        {
            base.LoadPage(source, null, uiProperties);
        }

        public void GoToPage(Page page, bool useHistory)
        {
            IDictionary<string, object> uiProperties = new Dictionary<string, object>();
            uiProperties.Add("Page", page);
            uiProperties.Add("Application", this.application);
            if(useHistory)
                this.GoToPage(page.Template, uiProperties);
            else
                base.LoadPage(page.Template, null, uiProperties);
        }
    }
}
